
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Downfile · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="dynamic-routing.html" />
    
    
    <link rel="prev" href="control loading.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    前端进阶
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="Grid System.html">
            
                <a href="Grid System.html">
            
                    
                    Grid System
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Handwritten signature.html">
            
                <a href="Handwritten signature.html">
            
                    
                    Handwritten Signature
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="Mobile Soft Keyboard.html">
            
                <a href="Mobile Soft Keyboard.html">
            
                    
                    Mobile Soft Keyboard
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="authentication.html">
            
                <a href="authentication.html">
            
                    
                    Authentication
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    Code
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" >
            
                <span>
            
                    
                    Four Operations
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="control loading.html">
            
                <a href="control loading.html">
            
                    
                    Control Loading
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.9" data-path="downfile.html">
            
                <a href="downfile.html">
            
                    
                    Downfile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="dynamic-routing.html">
            
                <a href="dynamic-routing.html">
            
                    
                    Dynamic Routing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="ecs.html">
            
                <a href="ecs.html">
            
                    
                    Ecs
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="engineering.html">
            
                <a href="engineering.html">
            
                    
                    Engineering
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="eslint-vscode-format.html">
            
                <a href="eslint-vscode-format.html">
            
                    
                    Eslint Vscode Format
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="eventloop.html">
            
                <a href="eventloop.html">
            
                    
                    Eventloop
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="four-operations-1.html">
            
                <a href="four-operations-1.html">
            
                    
                    Four Operations 1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="four-operations-2.html">
            
                <a href="four-operations-2.html">
            
                    
                    Four Operations 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="four-operations-3.html">
            
                <a href="four-operations-3.html">
            
                    
                    Four Operations 3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="four-operations-4.html">
            
                <a href="four-operations-4.html">
            
                    
                    Four Operations 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="front end summary.html">
            
                <a href="front end summary.html">
            
                    
                    Front End Summary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="git commit style.html">
            
                <a href="git commit style.html">
            
                    
                    Git Commit Style
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="git-commands.html">
            
                <a href="git-commands.html">
            
                    
                    Git Commands
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="high-quality-code.html">
            
                <a href="high-quality-code.html">
            
                    
                    High Quality Code
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="history.html">
            
                <a href="history.html">
            
                    
                    History
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24" data-path="html-tag.html">
            
                <a href="html-tag.html">
            
                    
                    Html Tag
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.25" data-path="http-https-http2.html">
            
                <a href="http-https-http2.html">
            
                    
                    Http Https Http2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.26" data-path="ignore log.html">
            
                <a href="ignore log.html">
            
                    
                    Ignore Log
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.27" >
            
                <span>
            
                    
                    Imgs
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.28" data-path="javascript-optimization.html">
            
                <a href="javascript-optimization.html">
            
                    
                    Javascript Optimization
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29" data-path="local application.html">
            
                <a href="local application.html">
            
                    
                    Local Application
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30" data-path="locality.html">
            
                <a href="locality.html">
            
                    
                    Locality
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.31" data-path="loop-unrolling.html">
            
                <a href="loop-unrolling.html">
            
                    
                    Loop Unrolling
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.32" data-path="mobile recommendation.html">
            
                <a href="mobile recommendation.html">
            
                    
                    Mobile Recommendation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.33" data-path="modal.html">
            
                <a href="modal.html">
            
                    
                    Modal
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.34" data-path="monitor.html">
            
                <a href="monitor.html">
            
                    
                    Monitor
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.35" data-path="performance.html">
            
                <a href="performance.html">
            
                    
                    Performance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.36" data-path="print-talbe.html">
            
                <a href="print-talbe.html">
            
                    
                    Print Talbe
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.37" data-path="promise.html">
            
                <a href="promise.html">
            
                    
                    Promise
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.38" data-path="teaching.html">
            
                <a href="teaching.html">
            
                    
                    Teaching
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.39" data-path="vue refresh.html">
            
                <a href="vue refresh.html">
            
                    
                    Vue Refresh
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.40" data-path="vue-page-not-refresh.html">
            
                <a href="vue-page-not-refresh.html">
            
                    
                    Vue Page Not Refresh
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.41" data-path="why-learn-theory.html">
            
                <a href="why-learn-theory.html">
            
                    
                    Why Learn Theory
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Downfile</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x524D;&#x7AEF;&#x4E0B;&#x8F7D;&#x4E8C;&#x8FDB;&#x5236;&#x6D41;&#x6587;&#x4EF6;">&#x524D;&#x7AEF;&#x4E0B;&#x8F7D;&#x4E8C;&#x8FDB;&#x5236;&#x6D41;&#x6587;&#x4EF6;</h1>
<p>&#x5E73;&#x65F6;&#x5728;&#x524D;&#x7AEF;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;&#x6709;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x4E00;&#x79CD;&#x662F;&#x540E;&#x53F0;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A; URL&#xFF0C;&#x7136;&#x540E;&#x7528; <code>window.open(URL)</code> &#x4E0B;&#x8F7D;&#xFF0C;&#x53E6;&#x4E00;&#x79CD;&#x5C31;&#x662F;&#x540E;&#x53F0;&#x76F4;&#x63A5;&#x8FD4;&#x56DE;&#x6587;&#x4EF6;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x5185;&#x5BB9;&#xFF0C;&#x7136;&#x540E;&#x524D;&#x7AEF;&#x8F6C;&#x5316;&#x4E00;&#x4E0B;&#x518D;&#x4E0B;&#x8F7D;&#x3002;</p>
<p>&#x7531;&#x4E8E;&#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x5F0F;&#x6BD4;&#x8F83;&#x7B80;&#x5355;&#xFF0C;&#x5728;&#x6B64;&#x4E0D;&#x505A;&#x63A2;&#x8BA8;&#x3002;&#x672C;&#x6587;&#x4E3B;&#x8981;&#x8BB2;&#x89E3;&#x4E00;&#x4E0B;&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F;&#x600E;&#x4E48;&#x5B9E;&#x73B0;&#x3002;</p>
<h2 id="blob&#x3001;ajaxaxios"><a href="https://developer.mozilla.org/zh-CN/docs/Web/API/Blob" target="_blank">Blob</a>&#x3001;ajax(axios)</h2>
<p>mdn &#x4E0A;&#x662F;&#x8FD9;&#x6837;&#x4ECB;&#x7ECD; <code>Blob</code> &#x7684;&#xFF1A;</p>
<blockquote>
<p>Blob &#x5BF9;&#x8C61;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x4E0D;&#x53EF;&#x53D8;&#x3001;&#x539F;&#x59CB;&#x6570;&#x636E;&#x7684;&#x7C7B;&#x6587;&#x4EF6;&#x5BF9;&#x8C61;&#x3002;Blob &#x8868;&#x793A;&#x7684;&#x4E0D;&#x4E00;&#x5B9A;&#x662F;JavaScript&#x539F;&#x751F;&#x683C;&#x5F0F;&#x7684;&#x6570;&#x636E;</p>
</blockquote>
<p>&#x5177;&#x4F53;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;</p>
<pre><code class="lang-js">axios({
  method: <span class="hljs-string">&apos;post&apos;</span>,
  url: <span class="hljs-string">&apos;/export&apos;</span>,
})
.then(res =&gt; {
  <span class="hljs-comment">// &#x5047;&#x8BBE; data &#x662F;&#x8FD4;&#x56DE;&#x6765;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x636E;</span>
  <span class="hljs-keyword">const</span> data = res.data
  <span class="hljs-keyword">const</span> url = <span class="hljs-built_in">window</span>.URL.createObjectURL(<span class="hljs-keyword">new</span> Blob([data], {type: <span class="hljs-string">&quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;</span>}))
  <span class="hljs-keyword">const</span> link = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">&apos;a&apos;</span>)
  link.style.display = <span class="hljs-string">&apos;none&apos;</span>
  link.href = url
  link.setAttribute(<span class="hljs-string">&apos;download&apos;</span>, <span class="hljs-string">&apos;excel.xlsx&apos;</span>)
  <span class="hljs-built_in">document</span>.body.appendChild(link)
  link.click()
  <span class="hljs-built_in">document</span>.body.removeChild(link)
})
</code></pre>
<p>&#x6253;&#x5F00;&#x4E0B;&#x8F7D;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x770B;&#x770B;&#x7ED3;&#x679C;&#x662F;&#x5426;&#x6B63;&#x786E;&#x3002;</p>
<p><img src="https://github.com/woai3c/Front-end-articles/blob/master/imgs/downfile1.jpg" alt="img1"></p>
<p>&#x4E00;&#x5806;&#x4E71;&#x7801;...</p>
<p>&#x4E00;&#x5B9A;&#x6709;&#x54EA;&#x91CC;&#x4E0D;&#x5BF9;&#x3002;</p>
<p>&#x6700;&#x540E;&#x53D1;&#x73B0;&#x662F;&#x53C2;&#x6570; <code>responseType</code> &#x7684;&#x95EE;&#x9898;&#xFF0C;<code>responseType</code> &#x5B83;&#x8868;&#x793A;&#x670D;&#x52A1;&#x5668;&#x54CD;&#x5E94;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF0C;&#x7531;&#x4E8E;&#x540E;&#x53F0;&#x8FD4;&#x56DE;&#x6765;&#x7684;&#x662F;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x636E;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x8981;&#x628A;&#x5B83;&#x8BBE;&#x4E3A; <code>arraybuffer</code>&#xFF0C;
&#x63A5;&#x4E0B;&#x6765;&#x518D;&#x770B;&#x770B;&#x7ED3;&#x679C;&#x662F;&#x5426;&#x6B63;&#x786E;&#x3002;</p>
<pre><code class="lang-js">axios({
  method: <span class="hljs-string">&apos;post&apos;</span>,
  url: <span class="hljs-string">&apos;/export&apos;</span>,
  responseType: <span class="hljs-string">&apos;arraybuffer&apos;</span>,
})
.then(res =&gt; {
  <span class="hljs-comment">// &#x5047;&#x8BBE; data &#x662F;&#x8FD4;&#x56DE;&#x6765;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x636E;</span>
  <span class="hljs-keyword">const</span> data = res.data
  <span class="hljs-keyword">const</span> url = <span class="hljs-built_in">window</span>.URL.createObjectURL(<span class="hljs-keyword">new</span> Blob([data], {type: <span class="hljs-string">&quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;</span>}))
  <span class="hljs-keyword">const</span> link = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">&apos;a&apos;</span>)
  link.style.display = <span class="hljs-string">&apos;none&apos;</span>
  link.href = url
  link.setAttribute(<span class="hljs-string">&apos;download&apos;</span>, <span class="hljs-string">&apos;excel.xlsx&apos;</span>)
  <span class="hljs-built_in">document</span>.body.appendChild(link)
  link.click()
  <span class="hljs-built_in">document</span>.body.removeChild(link)
})
</code></pre>
<p><img src="https://github.com/woai3c/Front-end-articles/blob/master/imgs/downfile2.png" alt="img1"></p>
<p>&#x8FD9;&#x6B21;&#x6CA1;&#x6709;&#x95EE;&#x9898;&#xFF0C;&#x6587;&#x4EF6;&#x80FD;&#x6B63;&#x5E38;&#x6253;&#x5F00;&#xFF0C;&#x5185;&#x5BB9;&#x4E5F;&#x662F;&#x6B63;&#x5E38;&#x7684;&#xFF0C;&#x4E0D;&#x518D;&#x662F;&#x4E71;&#x7801;&#x3002;</p>
<h2 id="&#x6839;&#x636E;&#x540E;&#x53F0;&#x63A5;&#x53E3;&#x5185;&#x5BB9;&#x51B3;&#x5B9A;&#x662F;&#x5426;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;">&#x6839;&#x636E;&#x540E;&#x53F0;&#x63A5;&#x53E3;&#x5185;&#x5BB9;&#x51B3;&#x5B9A;&#x662F;&#x5426;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;</h2>
<p>&#x4F5C;&#x8005;&#x7684;&#x9879;&#x76EE;&#x6709;&#x5927;&#x91CF;&#x7684;&#x9875;&#x9762;&#x90FD;&#x6709;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;&#x7684;&#x9700;&#x6C42;&#xFF0C;&#x800C;&#x4E14;&#x8FD9;&#x4E2A;&#x9700;&#x6C42;&#x8FD8;&#x6709;&#x70B9;&#x53D8;&#x6001;&#x3002;</p>
<p>&#x5177;&#x4F53;&#x9700;&#x6C42;&#x5982;&#x4E0B;</p>
<ol>
<li>&#x5982;&#x679C;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;&#x7684;&#x6570;&#x636E;&#x91CF;&#x6761;&#x6570;&#x7B26;&#x5408;&#x8981;&#x6C42;&#xFF0C;&#x6B63;&#x5E38;&#x4E0B;&#x8F7D;&#xFF08;&#x6BCF;&#x4E2A;&#x9875;&#x9762;&#x9650;&#x5236;&#x4E0B;&#x8F7D;&#x6570;&#x636E;&#x91CF;&#x662F;&#x4E0D;&#x4E00;&#x6837;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x80FD;&#x5728;&#x524D;&#x7AEF;&#x5199;&#x6B7B;&#xFF09;&#x3002;</li>
<li>&#x5982;&#x679C;&#x6587;&#x4EF6;&#x8FC7;&#x5927;&#xFF0C;&#x540E;&#x53F0;&#x8FD4;&#x56DE; <code>{ code: 199999, msg: &apos;&#x6587;&#x4EF6;&#x8FC7;&#x5927;&#xFF0C;&#x8BF7;&#x91CD;&#x65B0;&#x8BBE;&#x7F6E;&#x67E5;&#x8BE2;&#x9879;&apos;, data: null }</code>&#xFF0C;&#x7136;&#x540E;&#x524D;&#x7AEF;&#x518D;&#x8FDB;&#x884C;&#x62A5;&#x9519;&#x63D0;&#x793A;&#x3002;</li>
</ol>
<p>&#x5148;&#x6765;&#x5206;&#x6790;&#x4E00;&#x4E0B;&#xFF0C;&#x9996;&#x5148;&#x6839;&#x636E;&#x4E0A;&#x6587;&#xFF0C;&#x6211;&#x4EEC;&#x90FD;&#x77E5;&#x9053;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;&#x7684;&#x63A5;&#x53E3;&#x54CD;&#x5E94;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x4E3A; <code>arraybuffer</code>&#x3002;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x636E;&#x65E0;&#x8BBA;&#x662F;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#xFF0C;&#x8FD8;&#x662F; JSON &#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x524D;&#x7AEF;&#x63A5;&#x6536;&#x5230;&#x7684;&#x5176;&#x5B9E;&#x90FD;&#x662F; <code>arraybuffer</code>&#x3002;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x8981;&#x5BF9; <code>arraybuffer</code> &#x7684;&#x5185;&#x5BB9;&#x4F5C;&#x4E2A;&#x5224;&#x65AD;&#xFF0C;&#x5728;&#x63A5;&#x6536;&#x5230;&#x6570;&#x636E;&#x65F6;&#x5C06;&#x5B83;&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5224;&#x65AD;&#x662F;&#x5426;&#x6709; <code>code: 199999</code>&#x3002;&#x5982;&#x679C;&#x6709;&#xFF0C;&#x5219;&#x62A5;&#x9519;&#x63D0;&#x793A;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#xFF0C;&#x5219;&#x662F;&#x6B63;&#x5E38;&#x6587;&#x4EF6;&#xFF0C;&#x4E0B;&#x8F7D;&#x5373;&#x53EF;&#x3002;&#x5177;&#x4F53;&#x5B9E;&#x73B0;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js">axios.interceptors.response.use(response =&gt; {
    <span class="hljs-keyword">const</span> res = response.data
    <span class="hljs-comment">// &#x5224;&#x65AD;&#x54CD;&#x5E94;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x662F;&#x5426; ArrayBuffer&#xFF0C;true &#x5219;&#x662F;&#x4E0B;&#x8F7D;&#x6587;&#x4EF6;&#x63A5;&#x53E3;&#xFF0C;false &#x5219;&#x662F;&#x6B63;&#x5E38;&#x63A5;&#x53E3;</span>
    <span class="hljs-keyword">if</span> (res <span class="hljs-keyword">instanceof</span> <span class="hljs-built_in">ArrayBuffer</span>) {
        <span class="hljs-keyword">const</span> utf8decoder = <span class="hljs-keyword">new</span> TextDecoder()
        <span class="hljs-keyword">const</span> u8arr = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>(res)
        <span class="hljs-comment">// &#x5C06;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x636E;&#x8F6C;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;</span>
        <span class="hljs-keyword">const</span> temp = utf8decoder.decode(u8arr)
        <span class="hljs-keyword">if</span> (temp.includes(<span class="hljs-string">&apos;{code:199999&apos;</span>)) {
            Message({
                <span class="hljs-comment">// &#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x4E3A; JSON &#x5BF9;&#x8C61;</span>
                message: <span class="hljs-built_in">JSON</span>.parse(temp).msg,
                type: <span class="hljs-string">&apos;error&apos;</span>,
                duration: <span class="hljs-number">5000</span>,
            })

            <span class="hljs-keyword">return</span> <span class="hljs-built_in">Promise</span>.reject()
        }
    }
    <span class="hljs-comment">// &#x6B63;&#x5E38;&#x7C7B;&#x578B;&#x63A5;&#x53E3;&#xFF0C;&#x7701;&#x7565;&#x4EE3;&#x7801;...</span>
    <span class="hljs-keyword">return</span> res
}, (error) =&gt; {
    <span class="hljs-comment">// &#x7701;&#x7565;&#x4EE3;&#x7801;...</span>
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">Promise</span>.reject(error)
})
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="control loading.html" class="navigation navigation-prev " aria-label="Previous page: Control Loading">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="dynamic-routing.html" class="navigation navigation-next " aria-label="Next page: Dynamic Routing">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Downfile","level":"1.9","depth":1,"next":{"title":"Dynamic Routing","level":"1.10","depth":1,"path":"前端进阶/dynamic-routing.md","ref":"前端进阶/dynamic-routing.md","articles":[]},"previous":{"title":"Control Loading","level":"1.8","depth":1,"path":"前端进阶/control loading.md","ref":"前端进阶/control loading.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["summary","livereload"],"pluginsConfig":{"summary":{},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"前端进阶/downfile.md","mtime":"2021-02-15T12:04:36.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-24T08:50:55.666Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

